<div class="wrapper-md" ng-controller="initialEntry">
    <toaster-container toaster-options="{'position-class': 'toast-top-center', 'close-button':true}"></toaster-container>
    <div ng-if="warehouseList" class="panel panel-default">
        <div class="panel-heading">
            {{title.title}}
            <!--<button style="float: right;margin-top: -5px;margin-left: 15px;" class="btn m-b-xs btn-sm btn-info btn-addon">-->
            <!--<i class="fa fa-trash-o"></i>删除-->
            <!--</button>-->
            <button ng-click="warehouseJump()"  style="float: right;margin-top: -5px;" class="btn m-b-xs btn-sm btn-primary btn-addon">
                <i class="fa fa-plus"></i>新建
            </button>
        </div>
        <div class="panel-body b-b b-light">
            搜索: <input id="filter" type="text" class="form-control input-sm w-sm inline m-r"/>
        </div>
        <div>
            <table class="table m-b-none" ui-jq="footable" data-filter="#filter" data-page-size="10">
                <thead>
                <tr>
                    <th data-toggle="true">{{columns[0].title}}</th>
                    <th>{{columns[1].title}}</th>
                    <th>{{columns[2].title}}</th>
                    <th>{{columns[3].title}}</th>
                    <th>{{columns[4].title}}</th>
                </tr>
                </thead>
                <tbody>
                <tr ng-repeat="tb in saveDate">
                    <td><a href ng-click="showInfo(tb)">{{tb.initialEntryDh}}</a></td>
                    <td>{{tb.zdr}}</td>
                    <td>{{tb.createTime}}</td>
                    <td>{{tb.initialEntrySrck}}</td>
                    <td>{{tb.initialEntryCgr}}</td>
                </tr>
                </tbody>
                <tfoot class="hide-if-no-paging">
                <tr>
                    <td colspan="5" class="text-center">
                        <ul class="pagination"></ul>
                    </td>
                </tr>
                </tfoot>
            </table>


        </div>
    </div>
    <div ng-if="warehouseAdd" class="panel panel-default">
        <div class="panel-heading">
            <u style="cursor:pointer"  ng-click="warehouseJump()">{{title.title}}</u> / {{title.addTitle}}
            <button ng-click="saveInfo('sm')" style="float: right;margin-top: -5px;margin-left: 5px;" class="btn m-b-xs btn-sm btn-primary btn-addon">
                <i class="fa fa-plus"></i>保存
            </button>
            <button ng-click="warehouseJump()" style="float: right;margin-top: -5px;margin-left: 5px;" class="btn m-b-xs btn-sm btn-default btn-addon">
                <i class="fa fa-hand-o-left"></i>返回
            </button>
        </div>
        <div class="panel-body">
            <div class="panel-body">
                <h3 style="text-align: center"><b>期初录入单</b></h3>
                <form class="form-horizontal" method="get">
                    <h7><b>单据基本信息</b></h7>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label" for="input-id-1">制&nbsp;&nbsp;单&nbsp;&nbsp;人</label>
                        <div class="col-sm-3">
                            <input disabled type="text" class="form-control" id="zdr" value="{{row.zdr}}">
                        </div>
                        <label class="col-sm-1 control-label" for="input-id-1">制单日期</label>
                        <div class="col-sm-3">
                            <input disabled type="text" class="form-control" id="createTime" value="{{row.createTime}}"/>
                        </span>
                        </div>
                        <label class="col-sm-1 control-label" for="input-id-1">单据编号</label>
                        <div class="col-sm-3">
                            <input disabled type="text" class="form-control" id="initialEntryDh" value="{{row.initialEntryDh}}">
                        </div>
                    </div>

                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label" for="input-id-2"><span style="color:red">*</span>收入仓库</label>
                        <div class="col-sm-3">
                            <select  class="form-control" ng-model="mylabel" ng-options="v for v in lists" id="initialEntrySrck"></select>
                        </div>
                        <label class="col-sm-1 control-label" for="input-id-3">入库日期</label>
                        <div class="col-sm-3" ng-controller="DatepickerDemoCtrl">
                            <input disabled style="width:83%;float: left" id="initialEntryRkrq" type="text" class="form-control" datepicker-popup="{{format}}" ng-model="dt" is-open="opened" datepicker-options="dateOptions" ng-required="true" close-text="关闭" />
                            <span class="input-group-btn">
                                <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                            </span>
                        </span>
                        </div>
                        <label class="col-sm-1 control-label" for="input-id-4"><span style="color:red">*</span>仓&nbsp;&nbsp;管&nbsp;&nbsp;人</label>
                        <div class="col-sm-3">
                            <input disabled style="width:84%;float: left" type="text" class="form-control" id="initialEntryCgr" value="{{row.initialEntryCgr}}">
                            <span class="input-group-btn">
                                <button ng-click="showSelectUser('initialEntryCgr')" class="btn btn-default" type="button"><i class="fa fa-plus"></i></button>
                            </span>
                        </div>
                    </div>
                    <div class="line line-dashed b-b line-lg pull-in"></div>
                    <div class="form-group">
                        <label class="col-sm-1 control-label" for="input-id-1">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注</label>
                        <div class="col-sm-11">
                            <textarea type="text" class="form-control" id="initialEntryBz" value="{{row.initialEntryBz}}">{{row.initialEntryBz}}</textarea>
                        </div>
                    </div>
                <div class="line line-dashed b-b line-lg pull-in"></div>
                <h7><b>入库商品明细</b></h7>
                <div class="line line-dashed b-b line-lg pull-in"></div>
                <div style="height: 35px;">
                    <button ng-click="addRows()" style="" class="btn m-b-xs btn-sm btn-success btn-addon">
                        <i class="fa fa-plus"></i>增加
                    </button>
                    <button ng-click="plsc()" style="" class="btn m-b-xs btn-sm btn-danger btn-addon">
                        <i class="fa fa-minus"></i>批量删除
                    </button>
                </div>
            </form>
                <table class="table m-b-none" style="border:1px solid #eaeff0;" border="" cellspacing="0px" cellpadding="0px" width="100%">
                    <thead>
                    <tr>
                        <th rowspan="2"><input class="checkbox" type="checkbox" ng-click="qx()"/></th>
                        <th style="vertical-align: middle;white-space:nowrap;" colspan="3">货品信息</th>
                        <th style="vertical-align: middle;white-space:nowrap;" rowspan="2">单位</th>
                        <th style="vertical-align: middle;white-space:nowrap;width: 10%;" rowspan="2">数量</th>
                        <th style="vertical-align: middle;white-space:nowrap;" rowspan="2">单价</th>
                        <th style="vertical-align: middle;white-space:nowrap;" rowspan="2">总金额</th>
                        <th style="vertical-align: middle;white-space:nowrap;" rowspan="2">备注</th>
                        <th style="vertical-align: middle;white-space:nowrap;" rowspan="2">到货日期</th>
                        <th style="vertical-align: middle;white-space:nowrap" rowspan="2">操作</th>
                    </tr>
                    <tr>
                        <th style="vertical-align: middle;white-space:nowrap;">货品编码</th>
                        <th style="vertical-align: middle;white-space:nowrap;">货品名称</th>
                        <th style="vertical-align: middle;white-space:nowrap;">规格型号</th>
                    </tr>
                    </thead>
                    <tbody id="table">
                    <tr ng-repeat="g in goods">
                        <td><input type="checkbox" name="ck" ng-click="ck($index)"></td>
                        <td>
                            <a href=""  ng-click="showSelectGoods(g,$index)" class="active" ui-toggle-class="">
                                <i class="fa fa-plus" id="{{g.initialEntryDetailsId}}initialEntryDetailsHpbm">{{g.initialEntryDetailsHpbm}}</i>
                            </a>
                        </td>
                        <td>{{g.initialEntryDetailsHpmc}}</td>
                        <td>{{g.initialEntryDetailsGgxh}}</td>
                        <td>{{g.initialEntryDetailsHpdw}}</td>
                        <td><input ng-model="goods[$index].initialEntryDetailsHpsl" ng-change="detailsInput.sl($index)" id="{{g.initialEntryDetailsId}}initialEntryDetailsHpsl" type="text" class="form-control" value="{{g.initialEntryDetailsHpsl}}"></td>
                        <td><a href=""  ng-click="SelectPrice($index,g)" class="active" ui-toggle-class="">
                            <i class="fa fa-plus" id="{{g.initialEntryDetailsId}}initialEntryDetailsHpdj">{{g.initialEntryDetailsHpdj}}</i>
                        </a></td>
                        <td>{{g.initialEntryDetailsHpzje}}</td>
                        <td><input ng-model="goods[$index].initialEntryDetailsBz" ng-change="detailsInput.bz($index)" type="text" class="form-control" id="{{g.initialEntryDetailsId}}initialEntryDetailsBz" value="{{g.initialEntryDetailsBz}}"></td>
                        <td><div ng-controller="DatepickerDemoCtrl">
                            <input
                                    style="width:64%;float: left" type="text"
                                    id="{{g.initialEntryDetailsId}}initialEntryDetailsDhrq"
                                    class="form-control"
                                    datepicker-popup="{{format}}" ng-model="dt" is-open="opened"
                                    datepicker-options="dateOptions" ng-required="true"
                                    close-text="关闭"
                                    value="{{g.initialEntryDetailsDhrq}}"/>
                            <span class="input-group-btn">
                            <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button>
                        </span>
                        </div></td>
                        <td>
                            <a ng-click="dele($index)" class="active" ui-toggle-class="">
                                <i class="fa fa-times text-danger text-active"></i>
                            </a>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <div class="line line-dashed b-b line-lg pull-in"></div>
        </div>
    </div>
</div>

<script type="text/ng-template" id="myModalContent.html">
    <div ng-include="'tpl/modal.html'"></div>
</script>
    <script type="text/ng-template" id="selectUser.html">
        <div ng-include="'tpl/selectUser.html'"></div>
    </script>
    <script type="text/ng-template" id="selectGoods.html">
        <div ng-include="'tpl/selectGoods.html'"></div>
    </script>
    <script type="text/ng-template" id="selectPrice.html">
        <div ng-include="'tpl/selectPrice.html'"></div>
    </script>